import tensorflow as tf
from tensorflow import keras
import IPython.display as display

import numpy as np
import matplotlib.pyplot as plt
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"

img_path = '/Users/stupidity/Documents/machineLearning/data/test_shoe2.jpg'

img_raw = tf.io.read_file(img_path)
img_tensor = tf.image.decode_image(img_raw)
img_final = tf.image.resize(img_tensor, [28, 28])
img = []
for i in range(len(img_final)):
    row = []
    for j in range(len(img_final[i])):
        row.append(img_final[i][j][0] / 255.0)
    img.append(row)
x_test = np.array([img])

plt.imshow(img)
plt.show()


print(x_test.shape)
y_test = np.array([7])

model = keras.models.load_model("models/fashion_mnist/model")
model.summary()

loss, acc = model.evaluate(x_test, y_test, batch_size=128)
print('Restored model, accuracy: {:5.2f}%'.format(100*acc))